package com.fpx.open.platform.dao.mapper1;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.fpx.open.platform.domain.prealert.DoorPickupTR;
import com.fpx.open.platform.domain.prealert.MailCargoTypeMapping;
import com.fpx.open.platform.domain.prealert.OrderAction;
import com.fpx.open.platform.domain.prealert.OrderHandover;
import com.fpx.open.platform.domain.prealert.PrealertDeclareInvoiceAttachTR;
import com.fpx.open.platform.domain.prealert.PrealertDeclareInvoiceTR;
import com.fpx.open.platform.domain.prealert.PrealertOrderAttachTR;
import com.fpx.open.platform.domain.prealert.PrealertOrderTR;
import com.fpx.open.platform.domain.prealert.PrealertShipperConsigneeTR;
import com.fpx.open.platform.domain.prealert.ProductMapping;
import com.fpx.open.platform.domain.prealert.Refunder;
import com.fpx.xms.api.base.model.OrderLifecycle;

@Repository
public interface PrealertOrderMapper {

    public void saveOrder(PrealertOrderTR order);

    public void saveOrderAttach(PrealertOrderAttachTR orderAttach);

    public void saveDeclareInvoiceAttach(PrealertDeclareInvoiceAttachTR invoiceAttach);

    public void saveDeclareInvoice(PrealertDeclareInvoiceTR invoice);

    public void saveShipperConsignee(PrealertShipperConsigneeTR contact);
    
    public List<PrealertOrderTR> getOrderByOrderNo(@Param("customerOrderNo") String customerOrderNo, @Param("serverOrderNo") String serverOrderNo);
    
    public List<PrealertOrderTR> getOrderWithSimpleByOrderNo(@Param("customerOrderNo") String customerOrderNo, @Param("serverOrderNo") String serverOrderNo);
    
    public List<PrealertOrderTR> getOrderByOrderNoOrServeHawbcode(@Param("customerOrderNo") String customerOrderNo, @Param("serverOrderNo") String serverOrderNo, @Param("cmId") String cmId); 

    public List<PrealertOrderTR> getOrderByOrderNoAndCmId(Map<String,Object> map);
    
    public PrealertOrderTR getOrderByNoAndCmId(@Param("orderNo") String orderNo, @Param("cmId") String cmId);

    public String getSequence(String sequenceName);

    public String getMailCargoType(String type);
    
    public List<MailCargoTypeMapping> getMailCargoTypeList();

    public ProductMapping getProductCode(String interCarrier);

    public String getOrderStatus(Map<String, Object> parameterMap);

    public int holdOrder(Map<String, Object> parameterMap);
    
    
    public int closeOrder(Map<String, Object> parameterMap);

    public void saveDoorPickup(DoorPickupTR pickupInfo);
    
    public void updateOrder(PrealertOrderTR order);
    
    /**
     * 添加订单交接信息
     * @param orderHandover
     */
    public void addOrderHandover(OrderHandover orderHandover);
    
    /**
     * 查询交接信息
     * @param packageCode 包裹代码
     * @param source 数据源
     * @return
     */
    public List<OrderHandover> queryOrderHandover(@Param("packageCode") String packageCode, @Param("source") String source);
    
    /**
	 * 添加订单生命周期
	 * @param orderLifeCycle
	 */
	void addOrderLifecycle(OrderLifecycle orderLifecycle);
	
	/**
	 * 添加退件人信息
	 * @param refunder
	 */
	void addRefunder(Refunder refunder);
	
	/**
	 * 更新订单附属信息
	 * @param orderAttach
	 */
	void updateOrderAttach(PrealertOrderAttachTR orderAttach);
	
	List<PrealertOrderTR> getOrderByNumber(@Param("orderNo") String customerOrderNo, @Param("serverOrderNo") String serverOrderNo);
	
	
	void addOrderAction(OrderAction orderAction);
	
	/**
	 * 查询ae订单的消费记录
	 * @param msgId 消息的唯一标识
	 * @return
	 */
	public List<String> getAEOrderConsumeRecordByMsgId(String msgId) ;
	
	/**
	 * 添加消息消费记录
	 * @param msgId
	 */
	public void addAEOrderConsumeRecord(String msgId) ;
}
